<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <title>用款付款抄送人驳回原因</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">
    <style type="text/css">
        textarea {
            outline: none;
            resize: none;
        }
    </style>
</head>
<body>
<div id="app" style="text-align:center;width:300px;height:200px;">
    <template v-if="peopleType=='1'||peopleType=='0'">
        <div class="pull-left" style="padding: 10px">选择驳回类型</div>
        <div style="padding: 8px">
            <input type="radio" value="终止用款" v-model="type" id="stop" name=""> &nbsp;
            <label for="stop" style="margin-left: -8px">终止用款&nbsp;&nbsp;&nbsp;&nbsp;</label>
            <input type="radio" value="其他原因" v-model="type" id="pause" name="">
            <label for="pause">其他原因&nbsp;&nbsp;</label>
        </div>
    </template>

    <textarea style="width:290px;margin-left:5px;height:150px;margin-top:5px;padding: 5px"
              v-model="reason" placeholder="请输入驳回原因..."></textarea>
    <br/>
    <input type="button" value="确定驳回" @click="doReturn" class="btn btn-primary btn-xs" style="margin-top: 10px"/>
</div>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js?t=54c6b89c"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        page: {
            urlParams: null,
            queryParams: {
                requestPage: 1,
                pageSize: 15
            },
            dataUrl: '',
            createQueryParams: function () {
            },
            getByPage: function (type) {
                $.ajax({
                    url: $.wyui.page.dataUrl,
                    data: JSON.stringify($.wyui.page.queryParams),
                    beforeSend: function () {

                    },
                    complete: function () {
                    },
                    success: function (r) {
                        $.wyui.page.queryParams.requestPage++;

                        if (r.data.sendData.pager && r.data.sendData.pager.pageCount == 0) {
                            r.data.sendData.pager.pageCount = 1;
                        }
                        if (type == "scroll") {
                            $.wyui.page.getByPage_scroll_callback(r.data.sendData.records);
                        } else {
                            if ($.wyui.page.getByPage_callback_new) {
                                $.wyui.page.getByPage_callback_new(r.data.sendData.records);
                            }
                        }

                    }
                });
            }
        },
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>
<script>
    function getUrlParamObj() {
        var args = new Object();
        var query = location.href;
        var pairs = query.split("&"); //www.cxybl.com break at ampersand
        for (var i = 0; i < pairs.length; i++) {
            var pos = pairs[i].indexOf('='); // look for "name=value"
            if (pos == -1) continue; // if not found, skip
            var argname = pairs[i].substring(0, pos); // extract the name
            var pos1 = argname.indexOf('?');
            if (pos1 > -1) {
                argname = argname.substring(pos1 + 1);
            }
            var value = pairs[i].substring(pos + 1); // extract the value
            value = decodeURIComponent(value); // decode it, if needed
            args[argname] = value; // store as a property
        }
        var ss = args.valueOf(0);
        obj = args;
        return args;
    }
</script>
<script type="text/javascript">
    var api = frameElement.api, W = api.opener;
    var app = new Vue({
        el: '#app',
        data: {
            peopleType: getUrlParamObj().type,
            auditFlag: getUrlParamObj().auditFlag,
            selectIds: getUrlParamObj().selectIds,
            reason: '',
            type: '其他原因',
            typeList: [
                {name: '终止用款', value: '终止用款'},
                {name: '其他原因', value: '其他原因'}]
        },
        methods: {
            doReturn: function () {
                //1-审核人驳回  0-抄送人驳回
                if (this.peopleType == 1) {
                    this.auditReturn()
                } else if(this.peopleType == 0) {
                    this.copierReturn()
                }else {
                    this.payReturn();
                }
            },
            copierReturn: function () {
                $.wyui.postMethod(urlConfig.apply.money.copierReturn, {
                    id: getUrlParamObj().id,
                    copierPersonId:getUrlParamObj().id,
                    auditFlag:getUrlParamObj().auditFlag,
                    copierReturnReason: getUrlParamObj().name + "(" + this.type + ":" + this.reason + ")"
                }, function (result) {
                    alert('驳回成功')
                    parent.refresh();
                    api.close();
                });
            },
            auditReturn: function () {
                $.wyui.postMethod(urlConfig.apply.money.applyAudit, {
                    id: getUrlParamObj().id,
                    userId: getUrlParamObj().currentAuditorId,
                    auditFlag: getUrlParamObj().auditFlag,
                    advise: this.type + ":" + this.reason
                }, function () {
                    alert('驳回成功')
                    parent.refresh();
                    api.close();
                });
            },
            payReturn:function () {
                $.wyui.postMethod("/apply/batchAudit.json", {
                    selectIds:getUrlParamObj().selectIds,
                    userId: getUrlParamObj().id,
                    advise: this.reason
                }, function () {
                    alert('驳回成功')
                    parent.refresh();
                    api.close();
                });
            }
        }
    });
</script>
</body>
</html>